package com.example.demo.controller;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;


@Controller
public class MainController {

	@GetMapping("/logout")
	public String logout() {
		return "redirect:http://localhost:8180/auth/realms/hello-world-authz/protocol/openid-connect/logout?redirect_uri=http://localhost:8081/sso/login";
	}
	
	@GetMapping("/logout2")
	public void logout2(HttpServletRequest request) {
		try {
			request.logout();
		} catch (ServletException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
